import { APlugin } from '../types/common.interface';
import { TableDatas } from '../cors/table-datas';
import { Injectable, PluginInjectable } from '../decorators/inject';
import { Config } from '../cors/config';
import { MergeCell } from '../cors/merge-cell';
import { Select } from '../cors/select';
import { ExecuteRecord } from '../cors/execute-record';
import { RenderTrigger } from '../cors/render-trigger';
import { DeleteRowCommand } from '../commands/delete-rows-command';

@Injectable()
@PluginInjectable('DeleteRow')
export class DeleteRow extends APlugin{
    constructor(
        protected tableDatas: TableDatas,
        protected conf: Config,
        protected mergeCells: MergeCell,
        protected select: Select,
        protected executeRecord: ExecuteRecord,
        protected render: RenderTrigger
    ) {
        super()
    }
    public init(): void {
        
    }
    protected commandFactory(rows: number[]) {
        return new DeleteRowCommand(this.tableDatas, this.render, this.conf, this.mergeCells,this.select, rows);
    }
    protected delete() {
        let command = this.commandFactory([]);
        this.executeRecord.execute(command)
    }
    public destroy(): void {
        
    }
}